package com.cls.business.mapper;

import com.cls.business.entity.DeclareEntrust;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cls.business.entity.DeclarePlan;
import com.cls.business.entity.DeclareTopic;
import com.cls.business.vo.DeclareVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 委托课题信息附表 Mapper
 *
 * @author slx
 * @date 2020-12-02 14:25:22
 */
@Repository
public interface DeclareEntrustMapper extends BaseMapper<DeclareEntrust> {

    List<DeclareVo> findDeclareEntrustPage(@Param("declareVo") DeclareVo declareVo);
    List<DeclareVo> findDeclareEntrustPageOrder(@Param("declareVo") DeclareVo declareVo);
    @Select("select * from biz_declare_entrust where declare_id = #{declareId} and is_delete=0 limit 1")
    DeclareEntrust findByDeclareId(Long declareId);

    void updateCheck(@Param("declareEntrust")DeclareEntrust declareEntrust);
    @Select("select * from biz_declare_topic where is_delete=0 and declare_id  = #{declareId}")
    DeclareTopic getDeclareTopicById(Long declareId);

    void updateDeclareTipic(@Param("declareTopic")DeclareTopic declareTopic);
    @Select("select * from biz_declare_plan where is_delete=0 and declare_id  = #{declareId} and apply_count=#{applyCount} limit 1")
    DeclarePlan findPlan(@Param("declareId")Long declareId, @Param("applyCount")Integer applyCount);
}
